function ex_AircraftVP
A=[
0   0   1.132   0   -1
0   -0.0538 -0.1712 0   0.0705
0   0   0   1   0
0   0.0485  0   -0.8556 -1.013
0   -0.2909 0   1.0532  -0.6859
];
B=[
0   0   0
-0.12   1   0
0   0   0
4.419   0   -1.665
1.575   0   -0.0732
];
C=[
1   0   0   0   0
0   1   0   0   0
0   0   1   0   0
];
Q=C'*C;
R=eye(3);
K=lqr(A,B,Q,R)

x0=[10  100 -15 1   25];

P1=newplayer(...
'Vars',x0,...
'draw_player_trace_func',[],...
'draw_player_func','',...
'ode_func',@AVP_ode_func,...
'calc_pos_ang_func','AVP_pos_ang_func',...
'step_func','AVP_step',...
'A',A,...
'B',B,...
'Q',Q,...
'R',R,...
'K',K...
)

titles={'Altitude','Forward Speed','Pitch Angle','Pitch Rate','Vertical Speed'};
G=newgame({P1},...
'draw',2,...
'h',0.01,...
'max_time',20,...
'axis',[-10,10,-5,5],...
'pause','pause(0.01);',...
'plot_components',[1,2;3,5],...
'draw_game_board_func',''...
)
G.plot_titles=titles;
G.plot_labels=titles;

G=simgame(G)
